/**
 * Copyright 2009 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.sapien.util;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import ognl.OgnlRuntime;

/**
 * A Listener use for compatability between struts2 and google app engine.
 * @see http://www.nabble.com/Google-App-Engine-support--td22972179.html
 * @author Adam
 * @version $Id$
 * 
 * Created on May 10, 2009 at 10:29:28 PM 
 */
public class Struts2AppEngineListener implements ServletContextListener,
		HttpSessionListener, HttpSessionAttributeListener {

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	public void contextDestroyed(final ServletContextEvent event) { }

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized(final ServletContextEvent event) {
		OgnlRuntime.setSecurityManager(null); 
	}

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionCreated(final HttpSessionEvent event) { }

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionDestroyed(final HttpSessionEvent event) { }

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.http.HttpSessionAttributeListener#attributeAdded(javax.servlet.http.HttpSessionBindingEvent)
	 */
	public void attributeAdded(final HttpSessionBindingEvent event) { }

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.http.HttpSessionAttributeListener#attributeRemoved(javax.servlet.http.HttpSessionBindingEvent)
	 */
	public void attributeRemoved(final HttpSessionBindingEvent event) { }

	/**
	 * {@inheritDoc}
	 * @see javax.servlet.http.HttpSessionAttributeListener#attributeReplaced(
	 * javax.servlet.http.HttpSessionBindingEvent)
	 */
	public void attributeReplaced(final HttpSessionBindingEvent event) { }

}
